<%@page import="org.hibernate.Query"%>
<%@page import="org.hibernate.Transaction"%>
<%@page import="org.hibernate.Session"%>
<%@page import="com.friends.library.Dto.BookRegistration"%>
<%@page import="java.util.Iterator"%>
<%@page import="com.friends.library.persistence.HibernateUtil"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
   String emp_id = request.getParameter("id").toString();
   String buffer="";  
   try{
   Session session2=HibernateUtil.getSessionFactory().openSession();
   Transaction transaction=session2.beginTransaction();
   String sql="from BookRegistration as book where book.bookid=:bookid";
   Query query=session2.createQuery(sql);
   query.setString("bookid",emp_id);
   Iterator iterator=query.iterate();
   while(iterator.hasNext()){
   	BookRegistration bookRegistration=(BookRegistration)iterator.next();
   	int id=bookRegistration.getBookid();
   	String bookname=bookRegistration.getBookname();
   	String authorname=bookRegistration.getAuthorname();
   	
   	buffer=bookRegistration.getBookname()+":"+bookRegistration.getAuthorname();
   	
   }
 out.println(buffer);
 //System.out.println(buffer);
 }
 catch(Exception e){
 System.out.println(e);
 }
 %>